package com.usian.scheduled;

import com.usian.pojo.User;
import com.usian.service.UserService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

public class MyJob implements Job {
    private final static Logger logger = LoggerFactory.getLogger(MyJob.class);
    @Autowired
    private UserService userService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.debug("MyJob:"+new Date());
        userService.ScheduledTest();
        User user = new User();
        user.setUserName("aaa");
        user.setAddress("123");
        user.setInputDate(new Date());
        user.setRoleId(1);
        userService.add(user);
    }
}
